<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@taglib prefix="s" uri="/struts-tags" %>
<%@ page import="com.fengke.csc.config.HostConfig" %>
<%
	HostConfig hostConfig = (HostConfig) request.getSession().getServletContext().getAttribute("hostConfig");
%>
<div class="row">
	<div class="col-sm-6">
		<div class="dataTables_info">
			<s:if test="pageBean.pageSize > 1">
				显示第 <s:property value="pageBean.startIndex"/>-<s:property value="pageBean.endIndex"/> 个匹配结果（共 <s:property value="pageBean.resultItemCount"/> 个匹配结果）
			</s:if>
			<s:else>
				共 <s:property value="pageBean.resultItemCount"/> 个匹配结果
			</s:else>
		</div>
	</div>
	<div class="col-sm-6">
		<div class="dataTables_paginate paging_bootstrap">
			<ul class="pagination pull-right no-margin">
				<%-- 第一页是否小于等于1--%>
				<s:if test="pageBean.currentPage <= 1">
					<li class="prev disabled">
						<a ><i class="icon-double-angle-left"></i></a>
					</li>
				</s:if>
				<s:else>
					<li class="prev">
						<a onclick="gotoPage('<s:property value="pageBean.currentPage - 1" />')" style="cursor: pointer;"><i class="icon-double-angle-left"></i></a>
					</li>
				</s:else>
				
				<%--判断当前页是否大于2,并且总页数大于6 --%>
				<s:if test="pageBean.currentPage > 2 && pageBean.pageCount > 6">
					<li><a onclick="gotoPage('1')" style="cursor: pointer;">1</a></li>
					<li class="disabled"><a >...</a></li>
				</s:if>
				<%--判断 当前页与总页数的页差是否大于4--%>
				<s:if test="pageBean.pageCount - pageBean.currentPage > 4">
					<s:bean name="org.apache.struts2.util.Counter" id="counter">
						<s:param name="first" value="pageBean.currentPage-1" />
						<s:param name="last" value="pageBean.currentPage + 3" />
						<s:iterator>
							<s:if test="current == pageBean.currentPage">
								<li class="active"><a style="cursor: pointer;"><s:property value="current" /></a></li>
							</s:if>
							<s:else>
								<li><a onclick="gotoPage('<s:property value="current" />')" style="cursor: pointer;"><s:property value="current" /></a></li>
							</s:else>
						</s:iterator>
					</s:bean>
					<%--页差大于5时显示点 --%>
					<s:if test="pageBean.pageCount - pageBean.currentPage > 5">
						<li class="disabled"><a >...</a></li>
					</s:if>
					<%--显示尾页 --%>
					<li><a onclick="gotoPage('<s:property value="pageBean.pageCount" />')" style="cursor: pointer;"><s:property value="pageBean.pageCount" /></a></li>
				</s:if>
				<s:else>
					<s:if test="pageBean.pageCount <= 4">
						<s:bean name="org.apache.struts2.util.Counter" id="counter">
							<s:param name="first" value="0" />
							<s:param name="last" value="pageBean.pageCount - 1" />
							<s:iterator>
								<s:if test="current == pageBean.currentPage">
									<li class="active"><a style="cursor: pointer;"><s:property value="current" /></a></li>
								</s:if>
								<s:else>
									<li><a onclick="gotoPage('<s:property value="current" />')" style="cursor: pointer;"><s:property value="current" /></a></li>
								</s:else>
							</s:iterator>
						</s:bean>
					</s:if>
					<s:else>
						<s:bean name="org.apache.struts2.util.Counter" id="counter">
							<s:param name="first" value="pageBean.pageCount - 5" />
							<s:param name="last" value="pageBean.pageCount - 1" />
							<s:iterator>
								<s:if test="current == pageBean.currentPage">
									<li class="active"><a style="cursor: pointer;"><s:property value="current" /></a></li>
								</s:if>
								<s:else>
									<li><a onclick="gotoPage('<s:property value="current" />')" style="cursor: pointer;"><s:property value="current" /></a></li>
								</s:else>
							</s:iterator>
						</s:bean>
					</s:else>
				</s:else>

				<%--显示尾页 --%>
				<s:if test="pageBean.currentPage >= pageBean.pageCount">
					<li class="next disabled">
						<a ><i class="icon-double-angle-right"></i></a>
					</li>
				</s:if>
				<s:else>
					<li class="next">
						<a onclick="gotoPage('<s:property value="pageBean.currentPage + 1" />')" style="cursor: pointer;"><i class="icon-double-angle-right"></i></a>
					</li>
				</s:else>
			</ul>
		</div>
	</div>
</div>